﻿using System;

namespace Pariveda.DataAccess35.Business
{
    /// <summary>
    /// Partial class that supports audit capabilities
    /// </summary>
    internal partial class AdventureWorksDataContext
    {
        /// <summary>
        /// Inserts the customer and updates the modified date
        /// </summary>
        /// <param name="instance">The instance of the customer being inserted</param>
        partial void InsertCustomer(Customer instance)
        {
            instance.ModifiedDate = DateTime.Now;
            ExecuteDynamicInsert(instance);
        }

        /// <summary>
        /// Updates the customer and updates the modified date
        /// </summary>
        /// <param name="instance">The instance of the customer being updated</param>
        partial void UpdateCustomer(Customer instance)
        {
            instance.ModifiedDate = DateTime.Now;
            ExecuteDynamicUpdate(instance);
        }

        /// <summary>
        /// Inserts the customer address and updates the modified date
        /// </summary>
        /// <param name="instance">The instance of the address being inserted</param>
        partial void InsertCustomerAddress(CustomerAddress instance)
        {
            instance.ModifiedDate = DateTime.Now;
            ExecuteDynamicInsert(instance);
        }

        /// <summary>
        /// Updates the customer address and updates the modified date
        /// </summary>
        /// <param name="instance">The instance of the address being updated</param>
        partial void UpdateCustomerAddress(CustomerAddress instance)
        {
            instance.ModifiedDate = DateTime.Now;
            ExecuteDynamicUpdate(instance);
        }
    }
}
